package com.study.design.pattern.pattern.creational.singleton.threadlocal;

/**
 * @Author: gongsl
 * @Date: 2025-02-23 16:17
 * @description:
 */
public class ThreadLocalInstance {
    private static final ThreadLocal<ThreadLocalInstance> instanceLocal
            = ThreadLocal.withInitial(() -> new ThreadLocalInstance());

    private ThreadLocalInstance(){
        // 私有构造函数
    }

    public static ThreadLocalInstance getInstance(){
        return instanceLocal.get();
    }
}
